_require local "../../../../basis.smi"
_require "../../../../smlformat-lib.smi"
_require "../../../data/symbols/main/Loc.smi"

_require local "./USER_ERROR.sig"

structure UserError =
struct
  datatype errorKind = Error | Warning | Diagnosis of string
  type errorInfo = Loc.loc * errorKind * exn
  exception UserErrors of errorInfo list
  type errorQueue = errorInfo list ref
  val createQueue : unit -> errorQueue
  val clearQueue : errorQueue -> unit
  val isEmptyErrorQueue : errorQueue -> bool
  val enqueueError : errorQueue -> Loc.loc * exn -> unit
  val enqueueWarning : errorQueue -> Loc.loc * exn -> unit
  val enqueueDiagnosis : errorQueue -> Loc.loc * string * exn -> unit
  val format_errorInfo : errorInfo -> SMLFormat.FormatExpression.expression list
  val getErrorsAndWarnings : errorQueue -> errorInfo list
  val getErrors : errorQueue -> errorInfo list
  val getWarnings : errorQueue -> errorInfo list
  val getDiagnoses : errorQueue -> errorInfo list
end
